//
//  SHMeOrderButton.m
//  JiFengDaRen
//
//  Created by SH_iOS on 2017/5/27.
//  Copyright © 2017年 SH_iOS. All rights reserved.
//

#import "SHMeOrderButton.h"
#define KMETEXTCOLOR [UIColor colorWithHexString:@"#666666"]

@interface SHMeOrderButton()
@property(nonatomic,strong)UIImageView *leftImg;
@property(nonatomic,strong)SHLabel *textLabel;

@end
@implementation SHMeOrderButton

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        [self leftImg];
        [self textLabel];
       
    }
    return self;
}

- (UIImageView *)leftImg{
    if (!_leftImg) {
        _leftImg = [[UIImageView alloc]init];
        _leftImg.contentMode = UIViewContentModeScaleAspectFit;
//        _leftImg.userInteractionEnabled = YES;

        [self addSubview:_leftImg];
    }
    return _leftImg;
}

- (SHLabel *)textLabel{
    
    if (!_textLabel) {
        _textLabel = [SHLabel labelWithTextFont:14 textColor:KMETEXTCOLOR textAlignment:0 ];
//        _textLabel.userInteractionEnabled = YES;
        [self addSubview:_textLabel];
    }
    return _textLabel;
}

- (void)layoutSubviews{
    
    [_leftImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(__I6Width(30));
        make.height.mas_equalTo(__I6Width(30));
        make.centerY.mas_equalTo(self.mas_centerY);
        make.left.mas_equalTo(self.mas_left).with.offset(__I6Width(46));

    }];
    
    [_textLabel mas_makeConstraints:^(MASConstraintMaker *make){
        make.height.mas_equalTo(__I6Height(14));
        make.centerY.mas_equalTo(self.mas_centerY);
        make.left.mas_equalTo(_leftImg.mas_right).with.offset(__I6Width(12));
    }];
}

- (void)setLeftImageName:(NSString *)leftImageName{
    
    _leftImg.image = [UIImage imageNamed:leftImageName];
}
- (void)setTextLabelTitle:(NSString *)textLabelTitle{
    
    _textLabel.text = textLabelTitle;
}


//- (void)setHighlighted:(BOOL)highlighted {
//    [super setHighlighted:highlighted ];
//    
//    if (highlighted) {
//        
//        self.backgroundColor = KCELLHIGHTLIGHTED;
//    }else{
//        
//        self.backgroundColor = [UIColor whiteColor];
//        
//    }
//    
//}
//- (void)setSelected:(BOOL)selected {
//    [super setSelected:selected ];
//    
//    if (selected) {
//        
//        self.backgroundColor = KCELLHIGHTLIGHTED;
//        
//    }else{
//        
//        self.backgroundColor = [UIColor whiteColor];
//        
//    }
//    
//    
//}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
